home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2003 March / DPPCPRO0303.ISO / Components / Microsoft ASP / _SETUP.1 / ASPWizard.jar / asp / wizard / WVPanelDbQueryWhere$CustomComboBoxCellEditor.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-20  |  2.4 KB  |  50 lines

  1. package asp.wizard;
  2.  
  3. import com.sun.java.swing.ComboBoxEditor;
  4. import com.sun.java.swing.DefaultCellEditor;
  5. import com.sun.java.swing.JComboBox;
  6. import com.sun.java.swing.JTable;
  7. import java.awt.Component;
  8. import java.awt.event.ItemEvent;
  9. import java.awt.event.ItemListener;
  10.  
  11. class WVPanelDbQueryWhere$CustomComboBoxCellEditor extends DefaultCellEditor implements ItemListener {
  12.    // $FF: synthetic field
  13.    private final WVPanelDbQueryWhere this$0;
  14.    private int _editingRow;
  15.    private int _editingColumn;
  16.  
  17.    public WVPanelDbQueryWhere$CustomComboBoxCellEditor(WVPanelDbQueryWhere this$0, JComboBox comboBox) {
  18.       super(comboBox);
  19.       this.this$0 = this$0;
  20.       this.this$0 = this$0;
  21.       this._editingRow = -1;
  22.       this._editingColumn = -1;
  23.       comboBox.addItemListener(this);
  24.    }
  25.  
  26.    public Object getCellEditorValue() {
  27.       this._editingRow = this.this$0._tblCriteria.getEditingRow();
  28.       this._editingColumn = this.this$0._tblCriteria.getEditingColumn();
  29.       return super.getCellEditorValue();
  30.    }
  31.  
  32.    public void itemStateChanged(ItemEvent evt) {
  33.       JComboBox comboBox = (JComboBox)((DefaultCellEditor)this).getComponent();
  34.       ComboBoxEditor cbe = comboBox.getEditor();
  35.       int rowCount = this.this$0._tblCriteria.getRowCount();
  36.       int columnCount = this.this$0._tblCriteria.getColumnCount();
  37.       if (cbe != null && this._editingRow > -1 && this._editingColumn > -1 && evt.getStateChange() != 2) {
  38.          this.this$0._tblCriteria.setValueAt(cbe.getItem(), this._editingRow, this._editingColumn);
  39.          this._editingRow = this._editingColumn = -1;
  40.       }
  41.  
  42.    }
  43.  
  44.    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
  45.       this._editingRow = -1;
  46.       this._editingColumn = -1;
  47.       return super.getTableCellEditorComponent(table, value, isSelected, row, column);
  48.    }
  49. }
  50.